﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DcsGauges.Gui.Gauges.Interfaces;

namespace DcsGauges.Gui.Gauges.ValueConverters
{
    class StateConverter<TState> : IGaugeValueConverter<float, TState>
    {
        private Func<float, TState>                 convertFunction                         = null;
        private Func<TState, float>                 convertBackFunction                     = null;
        
        public StateConverter(Func<float, TState> convertFunction, Func<TState, float> convertBackFunction)
        {
            this.convertFunction            = convertFunction;
            this.convertBackFunction        = convertBackFunction;
        }

        public TState Convert(float inValue)
        {
            return this.convertFunction(inValue);
        }

        public float ConvertBack(TState state)
        {
            return this.convertBackFunction(state);
        }
    }
}
